package tool.plot

import java.io.File
import implicits.Implicits._
import shared.Pojo._
import tool.Pojo._
import tool.Tool
import tool.plot.AllPlot.RPlotB
import utils.Utils

/**
 * Created by yz on 27/9/2020
 */
object BorutaBox extends BorutaBoxT with RPlotB {

  def producePlotConfigFile(data: AllPlotData, workspaceDir: File, extraData: ExtraDataData) = {
    data.lines().toTxtFile(Tool.getPlotConfigTxtFile(workspaceDir, name))
    Utils.t2ConfigFile(data, new File(workspaceDir, s"${configJsonFileName}"))
  }

  override def getCommand(data:AllPlotData,extraData: ExtraDataData): String = {
    s"""
       |${"Rscript".condaPath()} ${new File(Tool.rPath, "boruta_plot.R").unixPath} --pc ${configFileName}
       |convert  -density 300 Decision_Boxplot.pdf  Decision_Boxplot.png
       |""".stripMargin
  }

  override def defaultPlotArg(tmpPlotData: AllPlotData): AllPlotData = {
    tmpPlotData.copy(
      color = tmpPlotData.color.copy(
        shadow = "#0000FF",
        rejected = "#FF0000",
        tentative = "#FFFF00",
        confirmed = "#00FF00",
      ),
      layout = tmpPlotData.layout.copy(
        width = "0",
        height = "6",
      ),
      xFont = "10",
      yFont = "6",
      yTitleFont = "11",
      legendFont = "9",
      legendTitle = "finalDecision",
      legendTitleFont = "11"
    )
  }


}

